﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;

namespace NotAClue.Web.DynamicData
{
	public class DefaultAttributesTypeDescriptionProvider : TypeDescriptionProvider
	{
		private Type Type { get; set; }

		public DefaultAttributesTypeDescriptionProvider(Type type)
			: this(type, TypeDescriptor.GetProvider(type))
		{
			this.Type = type;
		}

		public DefaultAttributesTypeDescriptionProvider(Type type, TypeDescriptionProvider parentProvider)
			: base(parentProvider)
		{
			this.Type = type;
		}

		public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
		{
			return new DefaultAttributesTypeDescriptor(base.GetTypeDescriptor(objectType, instance), this.Type);
		}
	}
}